/**********************************************************
 * File description:MainWindow.h
 * Function:ui主界面类
 * Current Version: 1.0.0
 * Author: 郭子涵，张宇轩
 * Date: 2022-10-03
 *  -----
 *  Copyright by bokun Software.
 **********************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <tuple>
#include <QMainWindow>
#include <QListView>
#include <QFileDialog>
#include <QString>
#include <QDebug>
#include <QtCharts>
#include <QTimer>
#include <QDebug>
#include <QSpacerItem>
#include <QList>
#include <QScrollArea>
#include <QMenu>
#include <QVariant>
#include <QDateTime>
#include <QTabWidget>
#include <QWidget>
#include <QMessageBox>
#include <QVBoxLayout>
#include <QLabel>
#include <QImage>
#include <QFrame>
#include <QTabBar>

#include "samplelibraryui.h"
#include "dyelibraryui.h"
#include "devicemanagementui.h"
#include "preference.h"
#include "pause.h"
#include "QPCR.h"
#include "QPCRDB.h"
#include "ExperimentService.h"
#include "ProcedureService.h"
#include "TargetService.h"
#include "global.h"
#include "ui_stagestep.h"
#include "stagestep.h"
#include "experimentui.h"
#include "Convertion.h"
#include "WLKService.h"
#include "maintain.h"
#include "PreferencesService.h"
#include "password.h"
#include "experimentui.h"
#include "aboutsoftware.h"
#include "experimentrestore.h"
#include "custommessagebox.h"
#include "analysisconfig.h"


namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

private:
    Ui::MainWindow *ui;

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

signals:
    void updateAnalysisConfig(); // 分析配置工具栏更新，发送信号

public slots:
    void saveAs(WLKData wlkData);
    void slotClosePage(int index);
    void slotChildClosePage();

private:
    ConnectedDeviceStruct cDevS;
    ExperimentUi *experimentUi;
    ExperimentUi *currentExperiment;
    int connectedDevice;
    int disconnectDevice;
    int runningDevice;
    int errorDevice;
    PreferencesService *preferencesService;
    CustomMessageBox *cusMsg;
    QString completeFilePath;
    QString fPath;
    QLabel *status;
    maintain *weihu;
    SampleWidget *samW;
    SlaveComputerManagement *scmW;
    TargetWidget *tarW;
    QList<ExperimentUi*> experimentList;
    WLKService *wlk;
    WLKData wlkImportData;
    passWord *pass;
    AboutSoftware *aboutSoftware;
    ExperimentRestore *experimentRestore;
    Preference *preW;
    AnalysisConfig *alysCfg; // 数据分析配置工具栏窗口
    QList<AnalysisTarget> alysTar; // 数据分析靶基因

private:
    void analysisWlkData(WLKData wlkImportData);
    void closeEvent(QCloseEvent*);
    void getAnalysisWlk();
    void getWLK();
    void newExperiment();
    void renderWlk(WLKData wlkImportData);
    void renderMainWindowDevice();
    void downloadInstructions(); // 下载说明书
    bool checkExistenceofWlk(QString sourceName); // 检查当前打开的wlk文件是否在其他页面也打开过（true-在其他页面打开了/false-在其他页面未打开）
    void sleep(int);

};

#endif // MAINWINDOW_H
